package com.account_main.config;

import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.validation.Validation;

@Configuration
public class ValidationConfig {
    @Bean
    public javax.validation.Validator validator(){
        //return的Validation 是javax.Validation
        return Validation.byProvider(HibernateValidator.class)
                .configure()
                .failFast(true)//设置快速失败
                .buildValidatorFactory()
                .getValidator();

    }
}
